##
#
# @file
#
# @brief Configure script of LibBSP for the LPC32XX boards.
#

AC_PREREQ([2.69])
AC_INIT([rtems-c-src-lib-libbsp-arm-lpc32xx],[_RTEMS_VERSION],[https://devel.rtems.org/newticket])
AC_CONFIG_SRCDIR([bsp_specs])
RTEMS_TOP(../../../../../..)

RTEMS_CANONICAL_TARGET_CPU
AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.12.2])
RTEMS_BSP_CONFIGURE

RTEMS_PROG_CC_FOR_TARGET
RTEMS_CANONICALIZE_TOOLS
RTEMS_PROG_CCAS

RTEMS_CHECK_NETWORKING
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")

RTEMS_BSPOPTS_SET([LPC32XX_OSCILLATOR_MAIN],[*],[13000000U])
RTEMS_BSPOPTS_HELP([LPC32XX_OSCILLATOR_MAIN],[main oscillator frequency in Hz])

RTEMS_BSPOPTS_SET([LPC32XX_OSCILLATOR_RTC],[*],[32768U])
RTEMS_BSPOPTS_HELP([LPC32XX_OSCILLATOR_RTC],[RTC oscillator frequency in Hz])

RTEMS_BSPOPTS_SET([LPC32XX_PERIPH_CLK],[*],[13000000U])
RTEMS_BSPOPTS_HELP([LPC32XX_PERIPH_CLK],[peripheral clock in Hz])

RTEMS_BSPOPTS_SET([LPC32XX_ETHERNET_RMII],[*],[1])
RTEMS_BSPOPTS_HELP([LPC32XX_ETHERNET_RMII],[enable RMII for Ethernet])

RTEMS_BSPOPTS_SET([LPC32XX_UART_1_BAUD],[*],[])
RTEMS_BSPOPTS_HELP([LPC32XX_UART_1_BAUD],[baud for UART 1])

RTEMS_BSPOPTS_SET([LPC32XX_UART_2_BAUD],[*],[])
RTEMS_BSPOPTS_HELP([LPC32XX_UART_2_BAUD],[baud for UART 2])

RTEMS_BSPOPTS_SET([LPC32XX_UART_3_BAUD],[*],[115200])
RTEMS_BSPOPTS_HELP([LPC32XX_UART_3_BAUD],[baud for UART 3])

RTEMS_BSPOPTS_SET([LPC32XX_UART_4_BAUD],[*],[115200])
RTEMS_BSPOPTS_HELP([LPC32XX_UART_4_BAUD],[baud for UART 4])

RTEMS_BSPOPTS_SET([LPC32XX_UART_5_BAUD],[*],[115200])
RTEMS_BSPOPTS_HELP([LPC32XX_UART_5_BAUD],[baud for UART 5])

RTEMS_BSPOPTS_SET([LPC32XX_UART_6_BAUD],[*],[115200])
RTEMS_BSPOPTS_HELP([LPC32XX_UART_6_BAUD],[baud for UART 6])

RTEMS_BSPOPTS_SET([LPC32XX_UART_7_BAUD],[*],[])
RTEMS_BSPOPTS_HELP([LPC32XX_UART_7_BAUD],[baud for UART 7])

RTEMS_BSPOPTS_SET([LPC32XX_CONFIG_U3CLK],[*],[0x00001386])
RTEMS_BSPOPTS_HELP([LPC32XX_CONFIG_U3CLK],[clock configuration for UART 3])

RTEMS_BSPOPTS_SET([LPC32XX_CONFIG_U4CLK],[*],[0x00001386])
RTEMS_BSPOPTS_HELP([LPC32XX_CONFIG_U4CLK],[clock configuration for UART 4])

RTEMS_BSPOPTS_SET([LPC32XX_CONFIG_U5CLK],[*],[0x00001386])
RTEMS_BSPOPTS_HELP([LPC32XX_CONFIG_U5CLK],[clock configuration for UART 5])

RTEMS_BSPOPTS_SET([LPC32XX_CONFIG_U6CLK],[*],[0x00001386])
RTEMS_BSPOPTS_HELP([LPC32XX_CONFIG_U6CLK],[clock configuration for UART 6])

RTEMS_BSPOPTS_SET([LPC32XX_DISABLE_MMU],[*],[])
RTEMS_BSPOPTS_HELP([LPC32XX_DISABLE_MMU],[disable MMU])

RTEMS_BSPOPTS_SET([LPC32XX_DISABLE_READ_WRITE_DATA_CACHE],[*],[])
RTEMS_BSPOPTS_HELP([LPC32XX_DISABLE_READ_WRITE_DATA_CACHE],[disable cache for read-write data sections])

RTEMS_BSPOPTS_SET([LPC32XX_DISABLE_READ_ONLY_PROTECTION],[*],[])
RTEMS_BSPOPTS_HELP([LPC32XX_DISABLE_READ_ONLY_PROTECTION],[disable MMU protection of read-only sections])

RTEMS_BSPOPTS_SET([LPC32XX_SCRATCH_AREA_SIZE],[lpc32xx_mzx*],[4096])
RTEMS_BSPOPTS_HELP([LPC32XX_SCRATCH_AREA_SIZE],[size of scratch area])

RTEMS_BSPOPTS_SET([LPC32XX_STOP_GPDMA],[*],[1])
RTEMS_BSPOPTS_HELP([LPC32XX_STOP_GPDMA],[stop general purpose DMA at start-up to avoid DMA interference])

RTEMS_BSPOPTS_SET([LPC32XX_STOP_ETHERNET],[*],[1])
RTEMS_BSPOPTS_HELP([LPC32XX_STOP_ETHERNET],[stop Ethernet controller at start-up to avoid DMA interference])

RTEMS_BSPOPTS_SET([LPC32XX_STOP_USB],[*],[1])
RTEMS_BSPOPTS_HELP([LPC32XX_STOP_USB],[stop USB controller at start-up to avoid DMA interference])

RTEMS_BSPOPTS_SET([LPC32XX_ENABLE_WATCHDOG_RESET],[*],[1])
RTEMS_BSPOPTS_HELP([LPC32XX_ENABLE_WATCHDOG_RESET],[bsp_reset() will use the watchdog to reset the chip])

RTEMS_BSPOPTS_SET([LPC_DMA_CHANNEL_COUNT],[*],[8])
RTEMS_BSPOPTS_HELP([LPC_DMA_CHANNEL_COUNT],[DMA channel count])

RTEMS_BSPOPTS_SET([BSP_START_RESET_VECTOR],[*],[])
RTEMS_BSPOPTS_HELP([BSP_START_RESET_VECTOR],[reset vector address for BSP start])

RTEMS_BSPOPTS_SET([BSP_USB_OTG_TRANSCEIVER_I2C_ADDR],[lpc32xx_mzx*],[(0x2c << 1)])
RTEMS_BSPOPTS_HELP([BSP_USB_OTG_TRANSCEIVER_I2C_ADDR],[USB OTG transceiver I2C address used by USB stack])

RTEMS_BSPOPTS_SET([BSP_USB_OTG_TRANSCEIVER_VBUS],[lpc32xx_mzx*],[USB_OTG_VBUS_POWER_WITH_CHARGE_PUMP])
RTEMS_BSPOPTS_HELP([BSP_USB_OTG_TRANSCEIVER_VBUS],[USB OTG transceiver VBUS policy])

RTEMS_BSPOPTS_SET([TESTS_USE_PRINTK],[*],[1])
RTEMS_BSPOPTS_HELP([TESTS_USE_PRINTK],[tests use printk() for output])

RTEMS_BSP_CLEANUP_OPTIONS(0, 1)
RTEMS_BSP_LINKCMDS

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
